package demo3;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何华树
 * Date: 2024-08-27
 * Time: 16:35
 */

class Student {
    private String name;
    private int age;
    private double score;
    private static String Classname = "1班";

    public Student(String name, int age, double score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    public void show() {
        System.out.println(GetClassname());//非静态方法当中，是可以直接调用 静态方法的
        System.out.println("姓名："+this.name+" 年龄："+this.age+" 成绩："+this.score);
    }
    public void doClass() {
        System.out.println(this.name+"在上课....");
    }
    public static String GetClassname() {
        /*
            静态方法 里面无法调用 非静态方法。
         */
//        this.name = "xiaohua";
//        show();
        return Classname;
    }
}

public class Test {
    public static int add(int a,int b) {
        return a + b;
    }

    public static void main(String[] args) {
        System.out.println(add(1, 2));//静态方法 里面可以直接调用 静态方法
    }
    public static void main2(String[] args) {
        System.out.println(Student.GetClassname());
    }
    public static void main1(String[] args) {
        Student student1 = new Student("xiaohuang",23,12.36);
        student1.show();

        Student student2 = new Student("xianhua",21,60.36);
        student2.show();

        Student student3 = new Student("wangwu",20,92.36);
        student3.show();
    }
}
